package com.demo.testpackage;

import com.demo.entity.Student;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class T5 {
    public static void main(String[] args) throws JsonProcessingException {

        ObjectMapper objectMapper = new ObjectMapper();

        Student student = new Student("1", "张三");
        System.out.println(student.toString());
        String s = objectMapper.writeValueAsString(student);
        System.out.println(s);
        Student student1 = objectMapper.readValue(s, Student.class);
        System.out.println(student1);
    }
}
